@extends("layouts.backend.webadmin")
@section('page-header')
    <h1>
        <small>falw\menu</small>
    </h1>
@endsection

@section('content')
<link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/select2/css/select2.min.css">
<link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/select2/css/select2totree.css">
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-body">
                <form action="{{ URL::route('admin.flaw.update') }}" method="POST">
                    <input type="hidden" class="form-control" id="id" name="id" value="{{$item->id}}">
                    <div class="form-group">
                        <label for="parentmenu">父级栏目</label>
                        <select class="form-control" id="parentmenu" name="pid">
                            <option class="l1 non-leaf" value="0">选择父级菜单</option>
                            @foreach($items as $iteme)
                                <option class="l{{$iteme->num+1}} {{$iteme->child=='yes'?'non-leaf':''}}" data-pup="{{$iteme->pid}}" value="{{ $iteme->id }}" @if($item->pid == $iteme->id) selected="selected" @endif>{{ $iteme->name }}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="menuname">标题</label>
                        <input type="text" class="form-control" id="menuname" placeholder="菜单名称" name="title" value="{{$item->title}}">
                    </div>
                    <div class="form-group">
                        <label for="menualias">别名</label>
                        <input type="text" class="form-control" id="menualias" placeholder="菜单别名" name="name" value="{{$item->name}}">
                    </div>
                    <div class="form-group">
                        <label for="keywords">关键词</label>
                        <input type="text" class="form-control" id="keywords" placeholder="关键词" name="keywords" value="{{$item->keywords}}">
                    </div>
                    <div class="form-group">
                        <label for="description">描述</label>
                        <input type="text" class="form-control" id="description" placeholder="描述" name="description" value="{{$item->description}}">
                    </div>
                    {!! csrf_field() !!}
                    <button type="submit" class="btn btn-default">更新</button>
                </form>
                </div>
        </div>
    </div>
</div>
</section>
@if($errors->any())
    <ul class="alert alert-danger">
        @foreach($errors->all() as $error)
            <li>{{ $error }}</li>
        @endforeach
    </ul>
@endif
@stop
@section('javascript-end')
    <script src="{{env('APP_ROOT')}}/assets/select2/js/select2.min.js"></script>
    <script src="{{env('APP_ROOT')}}/assets/select2/js/select2totree.js"></script>
    <script>
        $('#parentmenu').select2ToTree();
        $(function(){
            $('#parentmenu').select2ToTree({ width: '100%' });
        })
    </script>
@endsection